$(document).ready(function() {
    $('#defaultForm').bootstrapValidator({
        message: 'This value is not valid',
//        live: 'disabled',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            username: {
                validators: {
                    notEmpty: {
                        message: '用户名不能为空'
                    }
                }
            },
            email: {
                validators: {
                    notEmpty: {
                        message: '电子邮件地址不能为空'
                    },
                    //emailAddress: {
                      //  message: '无效的电子邮件地址'
                    //}
                }
            },
            password: {
                validators: {
                    notEmpty: {
                        message: '密码不能为空'
                    },
                    identical: {
                        field: 'confirmPassword',
                        message: '两次密码不同'
                    },
                    different: {
                        field: 'username',
                        message: '密码不能和账号相同'
                    }
                }
            },
            confirmPassword: {
                validators: {
                    notEmpty: {
                        message: '不能为空'
                    },
                    identical: {
                        field: 'password',
                        message: '两次密码不相同'
                    }
                }
            },
            birthday: {
                validators: {
                    notEmpty: {
                        message: '不能为空'
                    }
                }
            },
            phoneNumber: {
                validators: {
                    notEmpty: {
                        message: '不能为空'
                    },
                    digits: {
                        message: '电话号码只能为数字'
                    }
                }
            },
        }
    });
});


